package cn.simon.free.redis.mq.exceptions;

/**
 * 抽象异常类
 *
 * @author simon
 * @date 2021/11/10 10:30
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
public class AbsRedisMqException extends RuntimeException implements RedisMqException {
    /**
     * 错误码
     */
    private final Integer code;
    /**
     * 错误信息
     */
    private final String message;

    protected AbsRedisMqException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    protected AbsRedisMqException(RedisMqException redisMqException) {
        super(redisMqException.getMessage());
        this.code = redisMqException.getCode();
        this.message = redisMqException.getMessage();
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public int getCode() {
        return code;
    }
}
